<!DOCTYPE html>
<html>
    <head>
    	<meta charset="utf-8">
        <base href="${request.scheme}://${request.serverName}:${request.serverPort}${request.contextPath}/" />
        <title>实验室管理 </title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="renderer" content="webkit" />
        <meta http-equiv=X-UA-Compatible content="IE=edge,chrome=1">
		<meta content=always name=referrer>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<link rel="stylesheet" type="text/css" href="assets/plugins/bootstrap-3.3.5/css/bootstrap.css">
		<link rel="stylesheet" type="text/css" href="assets/css/index.css">
		<link rel="stylesheet" type="text/css" href="//at.alicdn.com/t/font_70190_tifo9s34nlgzaor.css">
		<!-- 自定义滚动条所需要引用的样式 -->
		<link rel="stylesheet" type="text/css" href="assets/plugins/malihu-custom-scrollbar-plugin-3.1.3/jquery.mCustomScrollbar.min.css">
		
		<!-- <link rel="stylesheet" href="assets/plugins/zTree_v3/css/demo.css" type="text/css"> -->
		<link rel="stylesheet" href="assets/plugins/zTree_v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
		<!-- bootstap开关按钮 -->
		<link rel="stylesheet" href="assets/plugins/bootstrap-switch-master/dist/css/bootstrap3/bootstrap-switch.min.css" type="text/css">
		<link rel="stylesheet" href="assets/plugins/umeditor-v1.2.2/themes/default/css/umeditor.css" type="text/css" >
        <link rel="stylesheet" href="assets/plugins/layui-v2.2.5/layui/css/layui.css" type="text/css">
        <link rel="stylesheet" type="text/css" href="assets/htwj/css.css">
        <link href="assets/htwj/logo.ico" rel="shortcut icon">
         <style type="text/css">
/* 图片展示样式 */
.images_zone{position:relative; width:120px;height:120px; overflow:hidden; float:left; margin:3px 5px 3px 0; background:#f0f0f0;border:5px solid #f0f0f0; }
.images_zone span{display:table-cell;text-align: center;vertical-align: middle;overflow: hidden;width: 120px;height: 120px;}
.images_zone span img{width:120px; vertical-align: middle;}
.images_zone a{text-align:center; position:absolute;bottom:0px;left:0px;background:rgba(255,255,255,0.5); display:block;width:100%; height:20px;line-height:20px; display:none; font-size:12px;}
/* 进度条样式 */
.up_progress{width: 300px;height: 13px;font-size: 10px;line-height: 14px;overflow: hidden;background: #e6e6e6;margin: 5px 0;display:none;}
.up_progress .progress-bar{height: 13px;background: #11ae6f;float: left;color: #fff;text-align: center;width:0%;}
.fileinput_a{display:inline-block; width:120px; height:120px; background-image: url(assets/imgs/upload.jpg);  position:relative; overflow:hidden;}
.fileinput_a:hover{background-image: url(assets/imgs/upload.jpg); }
.fileinput_input{position:absolute; right:0; top:0; font-size:100px; opacity:0; filter:alpha(opacity=0);}
</style>
   <style type="text/css">
 a{ color:#4599e0;}
 .wrap{ max-width:640px; height:auto; overflow:hidden; margin:0 auto;}
 label{ font-weight:normal;}
 .wall .control-label{ padding-top:0px;}
 .form-horizontal .form-group{ margin:0 0 15px; padding:0;}
 .control-label{ color:#666; padding:0; font-size:14px;}
 .form-control{ border-radius:0px; border:1px #dadada solid; box-shadow:none;}
 .form-control[disabled]{ background-color:#fff;}
 .hytitle{ height:36px;}
 .hytitle span{ width:90px; text-align:center; font-size:15px; height:36px; line-height:36px; display:block; border-bottom:3px #2e8ded solid ; color:#2e8ded; font-weight:bold;}
 .hytitle span i{ padding-right:5px;}
 .qian01{ background-color:#fff; width:100%; height:auto; overflow:hidden; padding:5px 15px 0;}
 .qian02{ background-color:#f8f8f8; width:100%; height:auto; overflow:hidden; padding:5px 15px 0;}
 .qian03{ background-color:#fff; width:100%; height:auto; overflow:hidden; padding:5px 15px 0;}
 .qian04{ background-color:#f8f8f8; width:100%; height:auto; overflow:hidden; padding:5px 15px 0;}
 hr{ border-top:1px #2e8ded solid; margin:-2px auto 20px;}
 .panel-default > .panel-heading{border-bottom:1px #ddd solid;  background-color:#e9f0fb;}
 .panel-heading i{ padding-right:5px;}
 .panel-heading{ height:29px; padding:0;}
 .panel-heading .spann01{ display:block; width:0; height:0; border-top: 14px solid  #e9f0fb;
  border-right: 14px solid #fff; border-bottom:14px solid #fff; border-left:14px solid #e9f0fb; float:left;}
 .panel-heading .spann02{ display:block; width:0; height:0; border-top: 14px solid  #e9f0fb; border-right: 14px solid #e9f0fb; border-bottom: 14px solid #fff; border-left:14px solid #fff; float:left;}
 .panel-heading .spann{ float:left; display:block; width:90px;  height:24px; text-align:center; line-height:24px; background-color:#fff; color:#2553a0; font-size:12px;}
 .hysearch{ padding:0; margin-bottom:15px;}
 .hysearch span{ padding:0 10px 0 0;}
 .hysearch input,.hysearch select{ width:75%;}
 .principal{ font-size:12px;}
 .principal input{ margin-right:5px;}
 .form-control{ font-size:14px; color:#999;}
 .laypageskin_molv span.laypage_total{ padding-right:0; margin-right:0;}
 .error{
	color:red;
}
.layui-form-label{width:100px}
body {
	margin: 0px;padding: 0;background-color:#f0f2f5;
	min-width: 1368px; min-height: 100%;overflow: hidden;
}
.container-fluid {
padding-left: 0;
}
</style>
</head>
<body>
<#dataList table="g_sys_dictionnary" where="status=1" orderBy="id desc";dataList>
${dataList}
</#dataList>
     <div class="header">
      <a href="content/index" class="header_fl fl" style="color:#fff;">
           <span></span><img src="images/items.png" style="width: 36px; height: 35px;">&nbsp;&nbsp; 实验管理系统
      <a class="fl" style="padding:13px 0 0 10px;" id="menuToggle"><i class="iconfont" style="color: #fff; font-size: 20px;">&#xe606;</i></a>
     <div class="header_fr fr">
       <a id="fullscreen" class="hometz" href="index" target="_black"><i class="iconfont icon-quanping"></i>全屏</a>
       <div class="peoin j-adminphoto">
       	<span class="spfl"><!-- <img id="userimg" src="${u.img!}"> --></span>
        <span id="username" class="spfr">${u.username!'用户名'}</span>
       </div>
       <div class="xiala j-adminm hidden">
        
         <div class="xiala02">
           <a id="updateInfo" onclick="updateUserInfo()"><img src="assets/htwj/01.png">修改信息</a>
           <a href="content/rbac/updatePass.html"><img src="assets/htwj/02.png">修改密码</a>
           <a href="javascript:logout();"><img src="assets/htwj/03.png">退出登录</a>
         </div>
       </div>
       <!-- <div class="header_fr_down">
         <span class="xgmm"><a href="user/toUpadatePass" target="view_window"><img src="assets/htwj/xgmm.png" width="20" height="20">修改密码</a></span>
         <span><a href="admin/logout"><img src="assets/htwj/tc.png" width="20" height="20">退出登陆</a></span>
       </div> -->
     </div>
   </div>
   <div class="content">
 		<div id="leftTree" class="aside-nav-warp">
			<!-- 这里是左侧的树形菜单 -->
                <h2 class="main_fl_h2">
                 <i class="glyphicon glyphicon-th-list"></i>功能导航
                </h2>
		<div id="aside-nav" class="aside-nav">
		</div>
 		</div>
 		<div id="aside-content" class="aside-content container-fluid">
  			<div class="col-md-12" id="page-content">
  			
  			</div>
  			<div class="col-md-12" style="margin-bottom: 51px;">
              <div class="footer">
   				版权所有
   		  	  </div>
   			</div>
 		</div>
	</div>
	<!--修改信息  -->
	<div id="updateUserFormDiv" class="hide" style="padding-top:15px;">
	<form class="form-horizontal" id="updateUserForm">
			<div class="form-group hide">
				<label for="inputEmail3" class="col-sm-2 control-label">登录名称</label>
				<div class="col-sm-9">
					<input type="hidden" id="id" name="user.id">
					<input type="text"  class="form-control" id="username2" placeholder="请输入登录名称" name="user.username" minlength="2"  maxlength="20" required>
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">真实姓名</label>
				<div class="col-sm-9">
					<input type="text"  class="form-control" id="name" placeholder="请输入用户真实姓名" name="user.name" minlength="2"  maxlength="20" required>
				</div>
			</div>
			<div class="form-group" id="image_content">
			    <label for="exampleInputEmail2" class="col-sm-2 control-label">上传个人头像</label>
				<div class="col-sm-9">
				    <div style="float:left;">
				        <div class="files" id="image_path3"></div>
			            <div style="clear:both;"></div><div class="up_progress"><div class="progress-bar"></div></div>
			            <div style="clear:both;"></div>
				    </div>
				    <div style="float:left;" class="fileinput_a" id="image_fileDiv3">
				    	<input class="fileinput_input imageupload3" type="file" value="浏览" name="image_files" data-url="upload/getFileUpload" multiple/>
	                </div>
	                <div style="float:left;" >
	              		 上传图片要求：格式（gif，jpe?g，png）最大为 2M
				    </div>
				    <br><br><br><br>
		         	<div id="tishi" class="hide"><font color="red">请上传个人头像！</font></div>
		         </div>
		    </div>
		    <div class="form-group">
				<label for="exampleInputEmail2" class="col-sm-2 control-label">个人简介</label>
				<div class="col-sm-9">
					<textarea rows="5" class="col-sm-12" id="des" placeholder="请输入个人简介" name="user.des"  minlength="2"  maxlength="200" required></textarea>
				</div>
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2" class="col-sm-2 control-label">验证邮箱</label>
				<div class="col-sm-9">
					<input type="email" class="form-control" id="email" placeholder="请输入邮箱" name="user.email" required>
				</div>
			</div>
			<div class="form-group">
				<label for="exampleInputEmail2" class="col-sm-2 control-label">手机号</label>
				<div class="col-sm-9">
					<input type="phone" class="form-control" id="phone" placeholder="请输入手机号" name="user.phone" required>
				</div>
			</div>
		 
		<div class="form-group">
		<label for="exampleInputEmail2" class="col-sm-2 control-label"></label>
			<div class="col-sm-9">
			<button type="submit" class="btn btn-success">立即提交</button>
			<button type="reset" class="btn btn-default">重置</button>
			</div>
		</div>
		
	</form>
</div>
</body>
<script type="text/javascript" src="assets/js/jquery1_12.min.js"></script>
<script type="text/javascript" src="assets/plugins/layui-v2.2.5/layui/layui.all.js"></script>
<script type="text/javascript" src="assets/plugins/malihu-custom-scrollbar-plugin-3.1.3/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript" src="assets/plugins/zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<script type="text/javascript" src="assets/plugins/zTree_v3/js/jquery.ztree.excheck-3.5.js"></script>

<script type="text/javascript" src="assets/plugins/bootstrap-switch-master/dist/js/bootstrap-switch.min.js"></script>
<script type="text/javascript" src="assets/js/jquery.form-3.51.js"></script>
<!-- <script type="text/javascript" src="assets/plugins/umeditor-v1.2.2/umeditor.js"></script>
<script type="text/javascript" src="assets/plugins/umeditor-v1.2.2/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="assets/plugins/umeditor-v1.2.2/lang/zh-cn/zh-cn.js"></script> -->
<script type="text/javascript" src="assets/plugins/jquery-validation-1.17.0/dist/jquery.validate.min.js"></script>
<script type="text/javascript" src="assets/plugins/jquery-validation-1.17.0/dist/localization/messages_zh.js"></script>
<script src="assets/plugins/jQuery-File-Upload-9.12.3/js/vendor/jquery.ui.widget.js"></script>
<script src="assets/plugins/jQuery-File-Upload-9.12.3/js/jquery.iframe-transport.js"></script>
<script src="assets/plugins/jQuery-File-Upload-9.12.3/js/jquery.fileupload.js"></script>

<script src="assets/plugins/jQuery-File-Upload-9.12.3/js/jquery.fileupload-process.js"></script>
<script src="assets/plugins/jQuery-File-Upload-9.12.3/js/jquery.fileupload-validate.js"></script>
<script type="text/javascript" src="assets/js/admin.js"></script>
<script type="text/javascript">
function adjust() {
	var w = document.body.clientWidth;
	/* var h = document.body.clientHeight; */
	if (w < 768) {
		$("#leftTree").hide();
		$("#aside-content").css("left", "0");
		$("#menuToggle").show();
	} else {
		$("#leftTree").show();
		$("#aside-content").css("left", "225px");
		$("#menuToggle").hide();
	}
};
</script>

<script type="text/javascript" src="assets/js/jquery.myTree.js"></script>
<script type="text/javascript" src="assets/js/jquery.myLayout.js"></script>


<script type="text/javascript">
$.get("ac/resources", function(data){
	switch (data.code){
	case 1:
		window.location.href="content/login";
		break;
	case 2:
		alert(data.content);
		window.location.href="content/login";
		break;
	}
	$("#aside-nav").toTree(data.content, 0); // 生成左侧树	
	$.onHeaderClick();
	$(".aside-nav").mCustomScrollbar({
		set_width: '225px',
		scrollButtons: {enable: true},
		theme: '#fff'
	});
    var $url = window.location.hash; // 获取hash值
	$.updateByUrl($url.substr(1)); // 首页
	$.initOpen($url);
	
	window.onhashchange = function() { // 监听hash值改变事件
		$.updateByUrl(window.location.hash.substr(1));
	};
	
	$(document).ready(function() {
		adjust();
		$(window).resize(function() {
			adjust();
		});
		$("#menuToggle").click(function() {
			$("#leftTree").css("z-index",99).slideToggle();
			return false;
		});
		/* $("#leftTree").blur(function() {
			$("#leftTree").slideUp();
		}) */
	});
	$(".head-dropdown-toggle").click(function() {
		$(this).next().slideToggle();
		return false;
	})
	$(".head-dropdown-toggle").blur(function() {
		$(this).next().slideUp();
		return false;
	})
});
</script>
<script type="text/javascript">
var index;
var validator;
$().ready(function() {
	// 手机号码验证
	jQuery.validator.addMethod("phone", function(value, element) {
	    var length = value.length;
	    var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
	    return this.optional(element) || (length == 11 && mobile.test(value));
	}, "请正确填写您的手机号码");
	 
	 validator = $("#updateUserForm").validate({
	        submitHandler:function(form){
	        	var img = $("#img").val();
	        	if(img==null || img ==""){
	        		$("#tishi").removeClass("hide");
        			return false;
	        	}else{
	        		$("#tishi").addClass("hide");
	        	}
	        	$.post('admin/userUpdate', $("#updateUserForm").serialize(), function(data){
	        		if(data.code==0){
	        			layer.msg("保存成功！");
	        			layer.close(index);
	        			//search(cc);
	        		}else{
	        			layer.msg(data.content);
	        			return false;
	        		}
	        		
	        	}) 
	        }    
	    });
	    $("#reset").click(function() {
	        validator.resetForm();
	    });
	    // 右上角用户信息
	    /* var user = JSON.parse(sessionStorage.getItem("user"));
	    if(user.img !=null){
	    	$("#userimg").attr("src",user.img);
	    }
	    if(user.name !=null){
	    	$("#username").html(user.name+'');
	    } */

	});
function updateUserInfo(){
	var tit = "修改信息";
		$.get("ac/user/selfInfo",function(data){
			if(data.code==0){
				//$(".teach").removeClass("hide");
				for (var key in data.content){
					$("#"+key).val(data.content[key]);
					if(key=="username"){
						$("#username2").val(data.content['username']);
					}
					if(key=="id"){
						$("#id").val(data.content['id']);
					}
				}
				var imgshow = '<div class="images_zone"><input type="hidden" id="img" name="img" value="'+data.content['img']+'" /><span><img src="'+data.content['img']+'"  /></span><a href="javascript:;">删除</a></div>';
	       	     $(".files").empty();
	       	     jQuery('#image_path3').append(imgshow);	//将上传之后的图片放到image_path3容器中
	       	     $("#image_fileDiv3").addClass("hide");
		 		     
					if(data.content['img']==null){
						$("#image_path3").empty();
						$("#image_fileDiv3").removeClass("hide");
					}
					$("#updateUserFormDiv").removeClass("hide");
					index=layer.open({
						type : 1,
						area: ['50%','80%'],
						title : tit,
						content : $("#updateUserFormDiv"),
						
						cancel: function(index, layero) {
							 validator.resetForm();//// 重置表单验证提示
							    
							$("#updateUserFormDiv").addClass("hide");
							layer.close(index);
						} 
					});		
			}else if(data.code == 1){
				$(".teach").addClass("hide");
				for (var key in data.content){
					$("#"+key).val(data.content[key]);
				}
				var imgshow = '<div class="images_zone"><input type="hidden" id="img" name="img" value="'+data.content['img']+'" /><span><img src="'+data.content['img']+'"  /></span><a href="javascript:;">删除</a></div>';
	       	     $(".files").empty();
	       	     jQuery('#image_path3').append(imgshow);	//将上传之后的图片放到image_path3容器中
	       	     $("#image_fileDiv3").addClass("hide");
		 		     
					if(data.content['img']==null){
						$("#image_path3").empty();
						$("#image_fileDiv3").removeClass("hide");
					}
					$("#updateUserFormDiv").removeClass("hide");
					index=layer.open({
						type : 1,
						area: ['50%','55%'],
						title : tit,
						content : $("#updateUserFormDiv"),
						
						cancel: function(index, layero) {
							 validator.resetForm();//// 重置表单验证提示
							    
							$("#updateUserFormDiv").addClass("hide");
							layer.close(index);
						} 
					});
			}else{
				layer.msg("获取信息失败！");
				return false;
			}
		});
 	
	return false;
};

</script>
<script>
/* 图片上传*********************************************************** */
$(".imageupload3").fileupload({
	dataType: 'json',
	maxFileSize : 5000000000, // 5 G，文件大小,这里没有用，在acceptFileSize限制文件大小
    add: function (e, data) {//将要上传的文件名显示在一个元素节点上：你可以经常要将上传的文件显示到特定的元素上，这个可以通过add回调函数来实现：
    	var select = $("#type").val();//获取选择框数据
    	var uploadErrors = [];//创建一个包含错误类型的数组
 		var acceptFileTypes;//设置上传文件的类型
 		var acceptFileSize;
 		select = 2;
 		if (select==2) {
 			acceptFileTypes = /^image\/(gif|jpe?g|png)$/i;
 			acceptFileSize = 2*1024*1024;//5M
		}
 		if(data.originalFiles[0]['type'].length && !acceptFileTypes.test(data.originalFiles[0]['type'])) {
 		   uploadErrors.push('文件类型不正确！');
 		  }
 		if(data.originalFiles[0]['size'] > acceptFileSize) {
 		   uploadErrors.push('文件太大了！');
 		  }
 		if(uploadErrors.length > 0) {
 		   alert(uploadErrors.join("\n"));
 		   return false;
 		  }else {
 			 var numItems = $('.files .images_zone').length;//获取图片容器内的图片数量
 			 if (select==2) {
 		    	if(numItems>=10){
 		    		alert('提交照片不能超过10张');
 		    		return false;
 		    	}
 			}
 	 		//**************************自动上传**************************
 	 		$('.up_progress .progress-bar').css('width','0px');//给进度条添加样式
		    $('.up_progress').show();//显示进度条
		    $('.up_progress .progress-bar').html('Uploading...');//显示进度条文字
		    data.submit(); 
		    //**************************自动上传**************************
		   
		}
    },
    done: function (e, data) {//完成之后的回调函数
    	var d = data.result;//获取的数据必须转为data.result才可以使用！！！
    	var select = $("#type").val();
    	select = 2;
    	$('.up_progress').hide();
    	$('.upl').remove();
        //var d = data.result;
        if (select==2) {
        	 $(".files").empty();
           	 var imgshow = '<div class="images_zone"><input type="hidden" id="img" name="user.img" value="upload/image/'+d.content+'" /><span><img src="upload/image/'+d.content+'"  /></span><a href="javascript:;">删除</a></div>';
           	 jQuery('#image_path3').append(imgshow);	//将上传之后的图片放到image_path3容器中
        	 $("#image_fileDiv3").addClass("hide");
 	 		 $("#image_reset3").removeClass("hide");
        }
    },
    progressall: function (e, data) {//所有文件的总体上传进度(progressall)显示
    	console.log(data);
        var progress = parseInt(data.loaded / data.total * 100, 10);
        $('.up_progress .progress-bar').css('width',progress + '%');
    }
});
//图片删除
$('.files').on({
	mouseenter:function(){
		$(this).find('a').show();
	},
	mouseleave:function(){
		$(this).find('a').hide();
	},
},'.images_zone');
$('.files').on('click','.images_zone a',function(){
	$(this).parent().remove();
	$("#image_fileDiv3").removeClass("hide");
});
function logout(){
	 if(confirm("确定退出吗？")){
		 $.post("ac/user/logout",function(data){
			 if(data.code==0){
				 //回到门户首页
				 window.location.href = "content/login.html";
			 }else{
				 layer.msg("操作失败！");
			 }
		 });
	}
}
</script>
<script type="text/javascript" src="assets/js/jquery.fullscreen.min.js"></script>
<script type="text/javascript">
$("#fullscreen").click(function() {
	$('body').fullscreen();
	return false;
})
</script>

</html>